<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <form class="layui-form serch" action="{:url('admin/hotel/search')}" method="post">
            <div class="layui-form-item layui-inline" style="float: none">
                <input type="hidden" name="VendorID" value="{$VendorID}">
                <input type="hidden" name="CityCode" value="{$CityCode}">
                <label class="layui-label">入住时间:</label>
                <div class="layui-inline" style="width:250px;">
                    <input name="arrivalDate" value="{if isset($wherelist['arrivalDate'])}{$wherelist['arrivalDate']}{/if}"  id="arrivalDate" placeholder="入住日期" autocomplete="off" class="layui-input" lay-verify="required" type="text">
                </div>
            </div>
            <div class="layui-form-item layui-inline" >
                <label class="layui-label">房间数:</label>
                <div class="layui-inline">
                    <input type="number" name="NumberOfRooms" autocomplete="off" value="{if isset($wherelist['NumberOfRooms'])}{$wherelist['NumberOfRooms']}{/if}" lay-verify="NumberOfRooms" placeholder="房间数" lay-verify="required" class="layui-input layui-btn-sm">
                </div>
            </div>
            <div class="layui-form-item layui-inline" style="float: none">
                <label class="layui-label">成人数:</label>
                <div class="layui-inline">
                    <input type="number" name="adult" autocomplete="off" value="{if isset($wherelist['adult'])}{$wherelist['adult']}{/if}" lay-verify="adult" placeholder="成人数" lay-verify="required" class="layui-input layui-btn-sm">
                </div>
            </div>
            <div class="layui-form-item layui-inline" style="float: none">
                <label class="layui-label">儿童数:</label>
                <div class="layui-inline">
                    <input type="number" name="child" autocomplete="off" value="{if isset($wherelist['child'])}{$wherelist['child']}{/if}" lay-verify="child" placeholder="儿童数" class="layui-input layui-btn-sm">
                </div>
            </div>
            <div class="layui-form-item layui-inline" >
                <button class="layui-btn layui-btn-default layui-btn-sm" lay-submit="" lay-filter="serch" id="search">查询</button>
            </div>
        </form>
    </fieldset>

    <table class="layui-table" lay-even="" lay-skin="line">
        <colgroup>
            <!--<col width="15%">-->
            <col width="10%">
            <col width="7%">
            <col width="7%">
            <col width="7%">
            <col width="20%">
            <col width="8%">
            <col width="40%">
        </colgroup>
        <thead>
        <tr>
            <!--<th>CODE</th>-->
            <th>酒店信息</th>
            <th>房型</th>
            <th>早餐</th>
            <th>可入住人数</th>
            <th>退订规则</th>
            <th>均价（间/日）</th>
            <th>价格明细</th>
        </tr>
        </thead>
        <tbody>
        {if !empty($info)}
        {volist name="info" id="vo"}
        <tr>
            <!--<td>{$vo.ProductCode}</td>-->
            <td>{$vo.ProductDetails|default=''}</td>
            <td>{$vo.RoomType}</td>
            <td>{$vo.MealPlan}</td>
            <td>{$vo.MaxOccupancy}</td>
            <td>
                {if $vo.NonRefundable>0}
                不可退订
                {else}
                可退订
                {/if}
            </td>

            <td class="totalPrice"></td>
            <td class="dayPrice">
                {if !empty($vo.NightlyInfo)}
                <table class="layui-table" lay-skin="row">
                    {if isset($vo.NightlyInfo.Dates)}
                    <tr>
                        <td>日期</td>
                        <td>{$vo.NightlyInfo.Dates}</td>
                    </tr>
                    <tr>
                        <td>价格</td>
                        <td>
                            <input type="hidden" class="price" value="{$vo.NightlyInfo.Prices.AdultPrice}">
                            ${$vo.NightlyInfo.Prices.AdultPrice}
                        </td>
                    </tr>
                    {else}
                    <tr>
                        <td>日期</td>
                        {volist name="$vo.NightlyInfo" id="vo2"}
                        <td>
                            {$vo2.Dates}
                        </td>
                        {/volist}
                    </tr>
                    <tr>
                        <td>价格</td>
                        {volist name="$vo.NightlyInfo" id="vo2"}
                        <td>
                            <input type="hidden" class="price" value="{$vo2.Prices.AdultPrice}">
                            ${$vo2.Prices.AdultPrice}
                        </td>
                        {/volist}
                    </tr>
                    {/if}
                </table>
                {/if}
            </td>
        </tr>
        {/volist}
        {/if}
        </tbody>
    </table>


    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script>
        layui.use(['layer','form','laydate'], function() {
            var layer = layui.layer;
            var form = layui.form;
            var laydate= layui.laydate;

            laydate.render({
                istime: true,
                elem: '#arrivalDate' //指定元素
                // ,type: 'datetime'
                ,range: '~' //或 range: '~' 来自定义分割字符
            });

            $(window).on('load', function() {
                //计算总价
                $(".dayPrice").each(function(){
                    var totalPrice = 0;
                    $(this).find(".price").each(function(){
                        var price = $(this).attr("value");
                        price = parseFloat(price);
                        totalPrice = totalPrice+price;
                        totalPrice = Math.round(totalPrice*100)/100;
                    });
                    $(this).prev(".totalPrice").text("$ "+totalPrice);
                });


            });

        });
    </script>


</body>
</html>
